<include file="Public/header" title="{$siteSetting['site_seo_title']}" keywords="{$siteSetting['site_seo_keywords']}" description="{$siteSetting['site_seo_description']}" />

	<!-- bootstrap-star-rating
	<link rel="stylesheet" href="__TMPL__Public/assets/plugins/bootstrap-star-rating/css/star-rating.min.css" />
	<script src="__TMPL__Public/assets/plugins/bootstrap-star-rating/js/star-rating.min.js"></script> -->
	
	<!-- MAIN -->
    <main class="x-content x-m-b-50">
    	<div class="page-hd">
	        <h1 class="page-hd-title">
				{$item.book_name}
	        </h1>
	        <p class="page-hd-desc">表单预览来自xui</p>
	    </div>
		<section class="x-box with-border pre-form">			
			<div class="x-box-header post-header with-border">
				<div><span class="">付款金额</span><span class="x-pull-right pre-pay-price">¥{$item.reg_order_price}</span></div>
			</div>
			<div class="x-box-body">
				<ul class="x-row x-list-value">
					<li class="x-col-12-12">
						<div class="x-row">
							<label class="x-col-2-12">订单号</label>
							<span class="x-col-10-12">{$item.order_sn}</span>
						</div>
					</li>
					<li class="x-col-12-12">
						<div class="x-row">
							<label class="x-col-2-12">期别</label>
							<span class="x-col-10-12">{$item.code_name}</span>
						</div>
					</li>
					<li class="x-col-12-12">
						<div class="x-row">
							<label class="x-col-2-12">人数</label>
							<span class="x-col-10-12">{$item.code_count}</span>
						</div>
					</li>
					<li class="x-col-12-12">
						<div class="x-row">
							<label class="x-col-2-12">备注</label>
							<span class="x-col-10-12">{$item.remark}</span>
						</div>
					</li>
				</ul>
			</div>
			<div class="x-box-footer with-border">
				<a class="x-block x-p-15 text-center" href="javascript:" onclick="callpay();" style="color:#0bb20c;">确定</a>
			</div>
		</section>
    </main>
    <!-- /MAIN -->

<script type="text/javascript">
function callpay() {
	var url = "{:U('Borrow/Index/payWithCard')}";
	
    var xloading = xpopup.loading();
	$.ajax({
        type: 'POST',
        url: url,
		data: {
			order_sn : '{$item.order_sn}',
			code_count: '{$item.code_count}'
		},
        dataType: 'json',
		async: false,
        success: function (data) {
    		xloading.destroy();												// loading

    		var type = '';
    		var msg = '';
    		var url = '';
    		if (data.code == 0) {
    			type = 'success';
    			url = "{:U('Wechat/Index/index')}";
    		} else {
    			type = 'error';
    			//url = "{:U('Wechat/Index/index')}";
    		};
    		
    		xpop.toast({
    		    type: type,
    	        msg: data.msg,
    	        delay: 1000,
    	        afterClose: function() {
    	        	if (url) {
    	        		window.location.href = url;
    	        	}
    	        }
    	    });
        },
		error: function (data) {
			kk.extError(data, xloading);
		}
    });
}
</script>
